<?php
class Mabout extends CI_Model {
	function __construct() {
		parent::__construct ();
	}
	
	function getAboutbyId($id) {
		$this->db->where ( 'id', $id );
		$query = $this->db->get ( 'about' );
		return $query->row_array ();
	}
	
	function addAbout($data) {
		$this->db->insert ( 'about', $data );
		return $this->db->insert_id ();
	}
	
	function updateAbout($data,$id) {
		$data ['updateTime'] = date ( "Y/m/d H:i:s", time () );
		$this->db->where ( 'id', $id );
		$this->db->update ( 'about', $data );
		if ($this->db->affected_rows () > 0)
			return TRUE;
		else
			return FALSE;
	}
	
	function getAboutListbyClass($class) {
		$this->db->select ( 'id,name,class,updateTime,updatePerson' );
		$this->db->where ( 'class', $class );
		$this->db->order_by("id", "asc"); 
		$query = $this->db->get ( 'about' );
		return $query->result_array ();
	}
	
	function getAboutListAll() {
		$this->db->select ( 'id,name,class,updateTime,updatePerson' );
		$query = $this->db->get ( 'about' );
		return $query->result_array ();
	}
	
	function delAboutbyId($id) {
		$this->db->where ( 'id', $id );
		$this->db->delete ( 'about' );
		if ($this->db->affected_rows () > 0)
			return TRUE;
		else
			return FALSE;
	}
}